package com.vishop.daos;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.vishop.models.Persoon;

@Repository
@Transactional
public class PersoonDaoImpl
{
	@Autowired
	private SessionFactory sessionFactory;

	public Persoon getById(int id){
		return (Persoon) sessionFactory.getCurrentSession().get(Persoon.class, id);
	}
	
	public int save(Persoon persoon){
		return (Integer) sessionFactory.getCurrentSession().save(persoon);
	}
	
	public void updatePunten(Persoon persoon)
	{
		sessionFactory.getCurrentSession().merge(persoon);
	}
}
